using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Entities;
using BUS;
using Utility;

public partial class Admin_SuaDanhmuc : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            LoadData();
    }
    private void LoadData()
    {
        try
        {
            int id = int.Parse(Request.QueryString["id"].ToString());
            txt_madanhm.Text = id.ToString();

            tbDanhmuc danhmuc = tbDanhmucBUS.GetByID(id);
           txt_tendanhm.Text = danhmuc.Tendanhm.ToString();
          
        }
        catch
        {
            Response.Redirect("~/Admin/DanhsachDanhmuc.aspx");
        }
    }
    protected void btn_sua_Click(object sender, EventArgs e)
    {
        try
        {
            int id = int.Parse(Request.QueryString["iD"].ToString());
            tbDanhmuc danhmuc = tbDanhmucBUS.GetByID(id);
            danhmuc.Tendanhm = txt_tendanhm.Text;

            tbDanhmucBUS.Update(danhmuc);
        }
        catch
        {

        }
        Response.Redirect("~/Admin/DanhsachDanhmuc.aspx");
        Response.Redirect(Request.RawUrl);
    }
}
